package org.hamster.common;

/**
 * Interface for IP address mask functionality.
 * Defines common operations for both IPv4 and IPv6 address masking.
 */
public interface IPMaskable {
    
    /**
     * Checks if the given IP address is within the range represented by this mask.
     * 
     * @param ip the IP address to check
     * @return true if the IP is valid and within range, false otherwise
     */
    boolean inRange(String ip);
    
    /**
     * Returns the start IP of the range as a string.
     * 
     * @return the start IP address
     */
    String getStartIp();
    
    /**
     * Returns the end IP of the range as a string.
     * 
     * @return the end IP address
     */
    String getEndIp();
    
    /**
     * Returns a string representation of the IP mask.
     * For a single IP, returns just the IP address.
     * For a range, returns the IP address with CIDR notation.
     * 
     * @return string representation of the IP mask
     */
    @Override
    String toString();
}